package com.pt25.service.sys.interfaces.facade.inner;


import com.pt25.base.dep.nacos.encrypt.EncryptUtil;
import com.pt25.base.res.ResBody;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Tag(name = "nacos encrypt inner api")
@RestController
@RequestMapping("/inner-api/sys")
public class NacosEncryptInnerController {

    @Resource
    private EncryptUtil encryptUtil;

    @Operation(summary = "加密nacos配置")
    @GetMapping("/nacos/encrypt")
    public ResBody encrypt(String value) {
        return ResBody.builder().data(encryptUtil.encrypt(value)).build();
    }

    @Operation(summary = "解密nacos配置")
    @GetMapping("/nacos/decrypt")
    public ResBody decrypt(String value) {
        return ResBody.builder().data(encryptUtil.decrypt(value)).build();
    }
}
